package servlet;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.DataDao;

public class WeekReportServlet extends HttpServlet{

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		this.doPost(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("utf-8");
		String company_id=request.getParameter("SeltPolluteSource");
		int outlet_id=Integer.parseInt(request.getParameter("SeltDischargePort"));
		String startdate=request.getParameter("StartDate");
		String enddate=request.getParameter("EndDate");
			DataDao ddao=new DataDao();
			List<Map> list=ddao.findWeekReport(company_id, outlet_id, startdate, enddate);
			
			request.setAttribute("list", list);	
			request.getRequestDispatcher("/statistical form/WeekReport.jsp").forward(request, response);
	}

}
